function showForm(){
    
  /*$("form").show('600', function() {
    // Animation complete.
  });*/
  $('#backlinkForm').show('600', function() {
    // Animation complete.
  }),
  $('.formButton').show('600', function(){
      
  });
  
}

function hideForm(){
    $('#backlinkForm').hide('600', function() {
    // Animation complete.
  });

  
}

function addColumns(){
   $('.column').clone().appendTo('#column');
}

function addChapter(){
    $('#chapter').clone().appendTo('.chapter');
}

function addBacklink() {
    //Add click function to the button
    $('#addBacklink').click(function() {
        $('.errorSmall').fadeOut();
        $('.successSmall').fadeOut();
        //Post data with ajax to codeigniter url
       $.post(base_url+'index.php/portal/addBacklink', $('.backlinkField form').serialize() , function(data) {
            if(data.error) {
                //If something has gone wrong, show the error that was returned from codeigniter
                $('.errorSmall').html(data.error);
                $('.errorSmall').fadeIn();
            }
            else {
                //Do this when there is no error
                $(':input','.backlinkField').val('');
                
                table = $('.scrollTable').dataTable();
                table.fnReloadAjax();
                
                $('.successSmall').html(data.success);
                $('.successSmall').fadeIn();
            }
        //Use json for data interchange    
        }, 'json');
        return false;
    });
}

function addRecord(){
        //Add click function to the button
    $('#addRecord').click(function() {
        $('.errorSmall').fadeOut();
        $('.successSmall').fadeOut();
        //Post data with ajax to codeigniter url
        $.post(base_url+'index.php/portal/addRecord', $('form').serialize() , function(data) {
            if(data.error) {
                //If something has gone wrong, show the error that was returned from codeigniter
                $('.errorSmall').html(data.error);
                $('.errorSmall').fadeIn();
            }
            else {
                //Do this when there is no error
                $(':input','form').val('');
                
                table = $('.scrollTable').dataTable();
                table.fnReloadAjax();
                
                $('.successSmall').html(data.success);
                $('.successSmall').fadeIn();
            }
        //Use json for data interchange    
        }, 'json');
    });
}

function addPerson(){
     //Add click function to the button
    $('#addPerson').click(function() {
        
        $('.errorSmall').fadeOut();
        $('.successSmall').fadeOut();
        //Post data with ajax to codeigniter url
        $.post(base_url+'index.php/portal/addPerson', $('#addPerson form').serialize() , function(data) {
            if(data.error) {
                //If something has gone wrong, show the error that was returned from codeigniter
                $('.errorSmall').html(data.error);
                $('.errorSmall').fadeIn();
            }
            else {
                //Do this when there is no error
                $(':input','#addPerson form').val('');
                
                table = $('.scrollTable').dataTable();
                table.fnReloadAjax();
                
                $('.successSmall').html(data.success);
                $('.successSmall').fadeIn();
            }
        //Use json for data interchange    
        }, 'json');
    });
    
}

function addAppointment(){
         //Add click function to the button
    $('#addAppointment').click(function() {
        $('.errorSmall').fadeOut();
        $('.successSmall').fadeOut();
        //Post data with ajax to codeigniter url
        $.post(base_url+'index.php/portal/addAppointment', $('#addAppointment form').serialize() , function(data) {
            if(data.error) {
                //If something has gone wrong, show the error that was returned from codeigniter
                $('.errorSmall').html(data.error);
                $('.errorSmall').fadeIn();
            }
            else {
                //Do this when there is no error
                $(':input','#addAppointment').val('');
                
                table = $('.scrollTable').dataTable();
                table.fnReloadAjax();
                
                $('.successSmall').html(data.success);
                $('.successSmall').fadeIn();
            }
        //Use json for data interchange    
        }, 'json');
    });
    
}

function addPartner(){
      //Add click function to the button
    $('#addPartner').click(function() {
        $('.errorSmall').fadeOut();
        $('.successSmall').fadeOut();
        //Post data with ajax to codeigniter url
        $.post(base_url+'index.php/portal/addAppointment', $('#addPartner form').serialize() , function(data) {
            if(data.error) {
                //If something has gone wrong, show the error that was returned from codeigniter
                $('.errorSmall').html(data.error);
                $('.errorSmall').fadeIn();
            }
            else {
                //Do this when there is no error
                $(':input','#addPartner').val('');
                
                table = $('.scrollTable').dataTable();
                table.fnReloadAjax();
                
                $('.successSmall').html(data.success);
                $('.successSmall').fadeIn();
            }
        //Use json for data interchange    
        }, 'json');
    });
}